package com.have.blog.admin.controller.rpc;

import com.have.blog.admin.service.SystemConfigFeignApi;
import com.have.blog.admin.service.SystemConfigService;
import com.have.blog.base.dto.SystemConfigDto;
import com.have.blog.base.wrapper.Wrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope
@RestController
public class SystemConfigFeign implements SystemConfigFeignApi {
    @Autowired
    private SystemConfigService systemConfigService;

    @Override
    public Wrapper<SystemConfigDto> getSystemConfig() {
        SystemConfigDto config = systemConfigService.getConfig();
        if (config == null) {
            return Wrapper.failed();
        }
        return Wrapper.success(config);
    }
}
